package com.komon.util;

import java.util.Date;

import com.komon.constant.Configuration;
import com.komon.constant.StringValueEnum;

public class CommonUtils {
	public static boolean isEmptyString(String s){
		return s == null || s.trim().equals("");
	}
	
	public static String replaceLWSwithSingelSP(String s){
		return s.replaceAll(Configuration.LWS, " ");
	}
	
	public static boolean isCRLF(String s) {
		return s.equals("\r\n");
	}
	
	public static <T extends Enum<T> & StringValueEnum> T getEnumByString(String string, Class<T> enumClazz) {
		for (T enumEntry : enumClazz.getEnumConstants()) {
			if (enumEntry.getStringValue().equals(string)) {
				return enumEntry;
			}
		}
		return null;
	}
	
	public static String getRFCDataString() {
		return Configuration.dateFormater.format(new Date());
	}
	
}
